import request from '@/utils/request'

// 充值相关 模块

// ---------------获取数据-----------------//

// 充值回调查询
export function recharge(data) {
  const formData = new FormData()
  for (const key in data) {
    formData.append(key, data[key])
  }
  return request({
    url: '/recharge/data.auth',
    method: 'post',
    data: formData
  })
}

// 充值详情统计
export function rechargeSum(data) {
  const formData = new FormData()
  for (const key in data) {
    formData.append(key, data[key])
  }
  return request({
    url: '/rechargeSummary/data.auth',
    method: 'post',
    data: formData
  })
}


// 虚拟充值(内部充值)
export function rechargeVirtual(data) {
  const formData = new FormData()
  for (const key in data) {
    formData.append(key, data[key])
  }
  return request({
    url: '/rechargeVirtual/data.auth',
    method: 'post',
    data: formData
  })
}

// 充值配置
export function rechargeProductCfg(data) {
  const formData = new FormData()
  for (const key in data) {
    formData.append(key, data[key])
  }
  return request({
    url: '/rechargeProductCfg/data.auth',
    method: 'post',
    data: formData
  })
}

// ------------------新增------------------//

// 发放-虚拟充值(内部充值)
export function addRechargeVirtual(data) {
  const formData = new FormData()
  for (const key in data) {
    formData.append(key, data[key])
  }
  return request({
    url: '/rechargeVirtual/add.authw',
    method: 'post',
    data: formData
  })
}


// ------------------其他------------------//

// 人工触发订单补发发货
export function manualRecharge(data) {
  const formData = new FormData()
  for (const key in data) {
    formData.append(key, data[key])
  }
  return request({
    url: '/recharge/manual.authw',
    method: 'post',
    data: formData
  })
}

// 更新充值配置
export function updateRechargeCfg() {
  return request({
    url: '/rechargeProductCfg/refresh.auth',
    method: 'post'
  })
}
